#ifndef _HDR_BITMAP
#define _HDR_BITMAP

#include <stdint.h>

#include "file.h"

//Greyscale pixel
typedef struct {
    uint8_t u0;
} b8px;

//Luminance pixel
typedef struct {
    uint8_t u0;
    uint8_t u8;
} b16px;

//RGB pixel
typedef struct {
    uint8_t u0;
    uint8_t u8;
    uint8_t u16;
} b24px;

//RGBA pixel
typedef struct {
    uint8_t u0;
    uint8_t u8;
    uint8_t u16;
    uint8_t u24;
} b32px;

//Defined size, we don't want no padding
#pragma pack(push)
#pragma pack(1)
typedef struct {
    uint8_t         bmp_str[2];
    uint32_t        bmp_size;
    uint16_t        resrvd1;
    uint16_t        resrvd2;
    uint32_t        data_loc;
} bmp_header;
typedef struct {
    uint32_t        hdr_size;
    uint32_t        bmp_width;
    uint32_t        bmp_height;
    uint16_t        bmp_colplan;
    uint16_t        bmp_bpp;
    uint32_t        bmp_comp_meth;
    uint32_t        bmp_size;
    uint32_t        bmp_hor_res;
    uint32_t        bmp_ver_res;
    uint32_t        bmp_pal_size;
    uint32_t        bmp_imp_cols;
} bmp_info;
typedef struct{
    uint8_t     anm_str[3];
    uint32_t    anm_width;
    uint32_t    anm_height;
    uint16_t    anm_bpp;
    uint16_t    anm_frame_num;
} anm_header;
#pragma pack(pop)

class bitmap{

    private:
        unsigned char   bpp;
        unsigned int    width;
        unsigned int    height;
        unsigned char*  data;

    public:
        bitmap();
        bitmap(unsigned int,unsigned int,unsigned char);
        bitmap(char*,unsigned char = 0);
        ~bitmap();

        unsigned int    getWidth();
        unsigned int    getHeight();
        unsigned int    getBpp();
        unsigned char*  Data();

        bool    loadFile(char*);
        void    loadSFile(file*,unsigned int,unsigned int,unsigned short);

};

#endif
